﻿@using HiLand.General.Entity
@model SimpleProductEntity
@{
    this.Layout = null;

    string productImageUrl = Url.Content("~/Content/Images/NoImage_340_255.jpg");
    if (Model.ProductMainImage != null)
    {
        string thumbnailUrl = Model.ProductMainImage.EnsureThumbnailAllVirtualPath(340, 255);
        if (string.IsNullOrWhiteSpace(thumbnailUrl) == false)
        {
            productImageUrl = thumbnailUrl;
        }
    }
    string productUrl = Url.Action("ProductDetails", "Product", new { productGuid = Model.ProductGuid });

    decimal productPrice = 0.00M;
    if (Model.ProductPricePromotion < Model.ProductPriceNormal)
    {
        productPrice = Model.ProductPricePromotion;
    }
    else
    {
        productPrice = Model.ProductPriceNormal;
    }
}
<div class="item item-largefeature">
    <div class="image">
        <a href="@productUrl">
            <img src="@productImageUrl" title="@Model.ProductName" alt="@Model.ProductName" />
        </a>
    </div>
    <div class="title">
        <h4>
            <a href="@productUrl">
                @Model.ProductName
            </a>
        </h4>
    </div>
    <div class="attributes">
        <h6>
            @Model.ProductBrand
        </h6>
    </div>
    <div class="offer">
        <ul>
            <li class="price">@productPrice</li>
            <li class="retail">@Model.ProductPriceReference</li>
        </ul>
    </div>
    <button title="详细信息" type="button" itemGuid="@Model.ProductGuid" name="btnDetails" class="btnDetails btn primary medium blue setalert">
        详细信息</button>
    <div class="break">
    </div>
</div>
<script type="text/javascript">
    jQuery(document).ready(function () {
        $(".btnDetails").click(function () {
            var itemGuid = $(this).attr("itemGuid");
            var baseUrl = '@Url.Action("ProductDetails", "Product")';
            var targetUrl = $.UrlUtil(baseUrl).concat("productGuid", itemGuid).show();
            window.location = targetUrl;
        });
    });
</script>
